1. Field of the Invention
The present invention relates to an on-board or on-chip microcomputer that can rewrite first nonvolatile rewritable memory for storing a user program.
2. Description of Background Art
FIG. 12 shows an electronic control unit (ECU) for vehicle control. An ECU 1 includes a microcomputer 3 and the other peripheral circuits (not shown) mounted on a substrate 2. A control program for the microcomputer 3 may be stored in rewritable nonvolatile memory such as flash memory 4 and may be executed by a central processing unit (CPU) 5. The control program is rewritten as needed for debugging or upgrading.
In order to rewrite the flash memory 4, the microcomputer 3 is set to a rewrite mode and is reset. For example, the microcomputer may be configured to be reset externally. The microcomputer 3 starts a rewrite program stored in ROM 6 of the microcomputer 3. The CPU 5 writes data transferred from an external rewriting apparatus (not shown). For example, the above described flash memory rewriting procedure is disclosed in Japanese Patent Application No. JP-2000-20178 A1.
It should be noted that in various circumstances, a rewrite may fail due to a power supply voltage drop that occurs during the process of flash memory rewriting or due to a disconnection of a communication line between the microcomputer and a rewriting apparatus. In such case, resetting the microcomputer can start a rewrite program and can be repeated to retry the rewrite.
In a typical vehicle control scenario, there is no need for resetting an ECU that is already operating in place, for example, on the vehicle. Further, providing an extra terminal for reset would be redundant and would increase costs. It would be preferable therefore to configure the ECU so as to use only a power-on reset that is already provided.
However, an ECU already operating in place is continuously supplied with power from a vehicle battery and no power-on reset occurs. Accordingly, the microcomputer can not be changed to a specific operation mode such as “rewrite mode.” Further, a dedicated terminal for mode change would be undesirable since it would increase costs.
A configuration without a reset and mode switch capability precludes the ability to start the rewrite program. Thus, when the flash memory rewriting fails, it cannot be retried.
For example, the ECU may execute a user program, such as an user program, embedded program, software program, or the like as will be appreciated by one of ordinary skill. The user program is stored in the flash memory during normal operation and the ECU can detect that a rewrite instruction is supplied from the external rewriting apparatus. In the above described case, the ECU can start the rewrite program and perform a rewrite of the user program at least once. When the rewrite fails, however, the user program cannot be normally executed thereafter and the CPU of the ECU cannot detect the rewrite instruction. For the above reasons, conventionally external reset and mode switch terminals have been required and therefore it has been difficult to decrease the number of microcomputer terminals.